package beans;

public class Person {

	public static final int UNPRIVILEGED = 0;
	public static final int PM = 1;
	public static final int ADMIN = 2;
	
	public static final String[] TYPE_ID = new String[] {
		"unprivileged",
		"pm",
		"admin"
	};
	
	public int id;
	public String email;
	public int type;
	
	public Person() { }

	public Person(int id, String email, int type) {
		super();
		this.id = id;
		this.email = email;
		this.type = type;
	}

	public static int subTypeToTypeId(String subType) {
		if ("PERS".equals(subType)) {
			return 0;
		} else if ("PROJ".equals(subType)) {
			return 1;
		} else if ("ADMN".equals(subType)) {
			return 2;
		}
			
		return -1;
	}

	public static String roleToSubType(String role) {
		if ("Unprivileged".equals(role)) {
			return "PERS";
		} else if ("PM".equals(role)) {
			return "PROJ";
		} else if ("Admin".equals(role)) {
			return "ADMN";
		}
			
		return "";
	}
	
}
